package com.hnichr.crm.common.product.entity;

import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 产品对象 crm_product
 *
 * @author Cheng
 * @date 2022-11-24
 */
@Data
@Entity
@Table(name = "crm_product")
@Schema(description = "产品表")
@EqualsAndHashCode(callSuper = false)
public class CrmProduct extends BaseEntity {

    /**
     * id
     */
    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;
    /**
     * 产品名称
     */
    @Schema(description = "产品名称")
    @Column(name = "name", length = 255)
    private String name;
    /**
     * 产品编码
     */
    @Schema(description = "产品编码")
    @Column(name = "num", length = 255)
    private String num;
    /**
     * 单位
     */
    @Schema(description = "单位")
    @Column(name = "unit", length = 255)
    private String unit;
    /**
     * 价格
     */
    @Schema(description = "价格")
    @Column(name = "price")
    private BigDecimal price;
    /**
     * 状态
     */
    @Schema(description = "状态")
    @Column(name = "status")
    @Dict(dicCode = "product_status")
    private Integer status;
    /**
     * 产品分类
     */
    @Schema(description = "产品分类")
    @Column(name = "category_id", length = 64)
    @Dict(dicCode = "product_category")
    private String categoryId;
    /**
     * 产品描述
     */
    @Schema(description = "产品描述")
    @Column(name = "description", length = 255)
    private String description;
    /**
     * 负责人ID
     */
    @Schema(description = "负责人ID")
    @Column(name = "owner_user_id", length = 64)
    @Dict(dicEntity = User.class, dicCode = "username", dicText = "nickname")
    private String ownerUserId;
    /**
     * 批次
     */
    @Schema(description = "批次")
    @Column(name = "batch_id", length = 64)
    private String batchId;

}
